Skip to content

Conversation

@AlbertvanHouten
Copy link
Contributor

@AlbertvanHouten AlbertvanHouten commented Oct 6, 2025

This pull request introduces a new set of strongly-typed enumerations for coordinate and image formats, and refactors the codebase to use these enums instead of string literals for format specification. It also adds new converters for bounding box, rotated bounding box, and polygon format conversions, improving type safety and extensibility in the annotation conversion pipeline. Additionally, there are minor improvements to documentation and workflow commands.

Core type system improvements:

  • Added new enums: BBoxFormat, RotatedBBoxFormat, PolygonFormat, and ImageFormat in fields.py, replacing string-based format specifications for bounding boxes, rotated bounding boxes, polygons, and images. All relevant field classes and helper functions have been updated to use these enums, improving type safety and code clarity. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13]

New format converters:

  • Added BBoxFormatConverter, RotatedBBoxFormatConverter, and PolygonFormatConverter classes to converters.py, enabling conversion between different formats (e.g., x1y1x2y2 ↔ xywh for bounding boxes, radians ↔ degrees for rotated bounding boxes, and (x, y) ↔ (y, x) for polygons). These converters leverage the new enums and provide robust, type-checked format transformations. [1] [2] [3] [4]

Documentation and developer experience:

  • Updated docstrings throughout field classes and helper functions to reflect the new enum-based format specification, clarifying expected types and defaults. [1] [2] [3] [4]
  • Improved a docstring in converter_registry.py for clarity regarding converter application.

Workflow enhancements:

  • Updated the documentation build workflows (docs_latest.yml, docs_stable.yml) to use uv pip install ... --system for installing requirements, ensuring correct environment handling. [1] [2]

Checklist

  • I have added tests to cover my changes or documented any manual tests.
  • I have updated the documentation accordingly

@AlbertvanHouten AlbertvanHouten requested a review from a team as a code owner October 6, 2025 13:48
Copilot AI review requested due to automatic review settings October 6, 2025 13:48
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds comprehensive format conversion support for various data types in the experimental converters module. It introduces enum-based format specifications for better type safety and implements converters to transform between different coordinate formats and image color spaces.

  • Introduces enum classes for format specifications (BBoxFormat, RotatedBBoxFormat, ImageFormat, PolygonFormat)
  • Adds new format converters for bbox, rotated bbox, polygon, and image data transformations
  • Updates existing code to use enum-based format specifications instead of string literals

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tests/unit/experimental/test_converters.py Adds comprehensive test coverage for new format converters and updates existing tests to use enum formats
src/datumaro/experimental/fields.py Introduces format enum classes and updates field classes to use enum-based format specifications
src/datumaro/experimental/converters.py Implements new format converter classes and updates existing converters to use enum formats
.github/workflows/docs_stable.yml Adds --system flag to pip install command for documentation builds
.github/workflows/docs_latest.yml Adds --system flag to pip install command for documentation builds
Comments suppressed due to low confidence (1)

tests/unit/experimental/test_converters.py:1

  • These removed imports (mask_callable_field, mask_field, rotated_bbox_field) appear to be unused after the refactoring. If they are indeed unused throughout the file, this cleanup is appropriate.
"""

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Signed-off-by: Albert van Houten <[email protected]>
Signed-off-by: Albert van Houten <[email protected]>
Signed-off-by: Albert van Houten <[email protected]>
 into albert/bbox-formats

Signed-off-by: Albert van Houten <[email protected]>

# Conflicts:
#	src/datumaro/experimental/converters.py
#	src/datumaro/experimental/fields.py
Signed-off-by: Albert van Houten <[email protected]>
Signed-off-by: Albert van Houten <[email protected]>
Signed-off-by: Albert van Houten <[email protected]>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@codecov-commenter
Copy link

codecov-commenter commented Oct 21, 2025

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 94.69027% with 6 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/datumaro/experimental/converters.py 95.50% 2 Missing and 2 partials ⚠️
src/datumaro/experimental/tiling/tilers.py 0.00% 1 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

@AlbertvanHouten AlbertvanHouten requested a review from a team as a code owner November 11, 2025 08:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants